<{include file="_head.html"}>
<script src="http://api.map.baidu.com/api?v=2.0&ak=mU3RirI2eGqq6gfy98j2tT9c
" type="text/javascript"></script><!-- 百度地图api -->
<script type="text/javascript" src="js/jquery.qqFace.js"></script> 
<style type="text/css">
  body, html {width: 100%;height: 100%;margin:0;font-family:"微软雅黑";}
  #allmap{width:100%;height:500px;}
  p{margin-left:5px; font-size:14px;}
</style>
<script type="text/javascript">
  $(function(){
    //添加、取消收藏
    $(".collect").click(function(){
      var isId=$(this).attr("isId");
      var newclass=isId==''?'collect a_aixin':'collect a_aixin1';
      var url='service_info.php?id=<{$smarty.get.id}>&action=collect';
      $.post(
        url,
        {isId:isId},
        function(data){
          if(data.error==1){
            alert(data.msg);
            $(".collect").attr('isId',data.isId);
            $(".collect").attr('class',newclass)
          }else if(data.error==2){
            alert(data.msg);
            window.location.href='login.php';
          }
        },'json'
        )
    })

    //添加取消赞。一般。烂
    $(".praise").click(function(){
      var obj=$(this);
      var isId=obj.attr("isId");
      var types=obj.attr("types");
      var url='service_info.php?id=<{$smarty.get.id}>&action=threePraise';
      $.post(
        url,
        {types:types,isId:isId},
        function(data){
          if(data.error==1){
            alert(data.msg);
            $(".praise").attr('isId',data.isId);
            obj.html(data.html)
          }else if(data.error==2){
            alert(data.msg);
            window.location.href='login.php';
          }
        },'json'
        )
    })

    //更多介绍
    $(".showmore").click(function(){
      var html='<{$service.intro}>';
      $(".showIntro").html(html);
    })


    //匹配表情-初始化
    $('.neirong').each(function(){
        var text=$(this).html();
        $(this).html(replace_em(text));
    })

    //回复用户效果变更
    $(".a_huifu1").live('click',function(){
      var user_id=$(this).attr("user_id"); //用户ID
      var name=$(this).attr("name");       //被回复人名称

      $("#huifuren").html('to reply to '+name);
      $(".reply_id").val(user_id);
    })

    //限制输入字数
    $(".text_ly_1").keyup(function(){
      var num='140'; //设置最大输入数
      var length=$(this).val().length;
      var shengyu=num-length
      $(".span_shuru").html('还可以输入'+shengyu+'字');
 
    })


    //评论
    $(".a_pinglun").click(function(){
      var reply_id=$(".reply_id").val();
      var comment=$(".text_ly_1").val();
      var service_id='<{$service.id}>';
      $.post(
            'service_info.php?action=comment',
            {comment:comment,reply_id:reply_id,service_id:service_id},
            function(data){
              if(data.error==1){
                alert(data.mes);
                // window.location.href="service_info.php?id="+service_id;
                $(".pinglun").eq(0).before(data.html);
                //替换表情
                var str = $(".neirong").eq(0).html();
                $(".neirong").eq(0).html(replace_em(str));
                //重置样式
                $(".text_ly_1").val('');
                $("#huifuren").html('');
                $(".reply_id").val(0);

              }else{
                alert("请先登录！");
                window.location.href="login.php";
              }
        },"json")


    })

    //表情特效
      $('.emotion').qqFace({ // 
        id : 'facebox', //表情盒子的ID
        assign:'saytext', //给那个控件赋值
        path:'images/face/' //表情存放的路径，注意如果修改了这个地方，下面正则匹配的地方也要做相应的修改
      });

  })

//表情替换
function replace_em(str){
    str = str.replace(/\</g,'&lt;');
    str = str.replace(/\>/g,'&gt;');
    str = str.replace(/\n/g,'<br/>');
    str = str.replace(/\[em_([0-9]*)\]/g,'<img src="images/face/$1.gif" border="0" />');
    return str;
}

</script>

<!--轮换图-->
<!-- <script type="text/javascript" src="js/focus.js"></script>
<link rel="stylesheet" type="text/css" href="css/jdt.css" /> -->
<script type="text/javascript" src="js/ScrollPic.js"></script>
<!--轮换图-->

<{include file="head.html"}>

<!-- <div class="zsfw_menu"><a href="#" id="zsfw_menu_lb">子时伙伴</a>|<a href="#">政策解读</a></div> -->
<div class="zsfw_menu">
<{foreach item=loop key=key from=$serviceClass}>
<!-- <a href="#" id="zsfw_menu_lb">子时伙伴</a>|<a href="#">政策解读</a> -->
 <a href="service_list.php?class_id=<{$loop.id}>" class="service <{if $service.class1_id==$loop.id}>active<{/if}>"><{if $key!='0'}>| &nbsp;&nbsp;<{/if}><{$loop.class_name}></a>
 <{/foreach}>
 </div>

<div class="main_zsfwhbjsy">
<span class="span_weizhi">首页  >  <{$service.className1}>  >  <{$service.className2}>  >　<{$service.title}></span>
<div class="zsfwhbjsy_bt"><span><{$service.title}></span><a href="javascript:;" isId="<{$service.is_collect.id}>" <{if $service.is_collect.id}> class="collect a_aixin" <{else}>class="collect a_aixin1"<{/if}>>&nbsp;</a></div>
<div class="clear"></div>

<div id="ISL_Cont_service" style="display:block;float:left;">
  <{if $albums!=''}>
  <{foreach item=loop from=$albums}>
  <img src="upload/service/large/<{$loop.img}>" width="557" height="334" style="display:block; float:left;" />
  <{/foreach}>
  <{else}>
  <img src="images/no_img.png" width="557" height="334" style="display:block; float:left;" />
  <{/if}>
</div>

<{if $albums!=''}>
<!--左右剪头-->
<a href="javascript:void(0);" id="LeftArr_service" style="position:absolute;top:380px"><img src="images/CustomBlackPrevious.gif" style="display:block; float:left;" /></a>
<a href="javascript:void(0);" id="RightArr_service" style="position:absolute;top:380px;left:650px;"><img src="images/CustomBlackNext.gif" style="display:block; float:left;" /></a>
<!--左右剪头-->
<{/if}>
<div class="zsfwhbjsy_right" style="position:;top:250px;left:710px;">
<p class="showIntro"><{$service.intro|truncate:80}> <a href="javascript:;" class="a_more showmore">more&gt;&gt;</a></p>
<table width="515" border="0" cellspacing="0" cellpadding="0" class="tab_z">
  <tr>
    <td width="193"><a href="javascript:;" isId="<{$service.threePraise.praise}>" types="praise" class="praise a_z1"><{$service.threePraise.praiseName}></a></td>
    <td width="192"><a href="javascript:;" isId="<{$service.threePraise.just}>" types="just" class="praise a_z2"><{$service.threePraise.justName}></a></td>
    <td width="130"><a href="javascript:;" isId="<{$service.threePraise.bad}>" types="bad" class="praise a_z3"><{$service.threePraise.badName}></a></td>
  </tr>
</table>
<div class="ads_time">
<p>地址：<{$service.provinceName}>-<{$service.cityName}>-<{$service.countyName}>-<{$service.address}></p>
<p>营业时间：<{$service.office_hours}></p>
<p>电话：<{$service.phone}></p>
<!-- <img src="images/fx_img.jpg" width="175" height="28" style="display:block; margin-top:30px;" /> -->
<!-- <img src="images/fx_img.jpg" width="175" height="28" style="display:block; float:left;" /> -->
  <!-- JiaThis Button BEGIN -->
    <div class="jiathis_style" style=" float:left; display:inline; padding:10px 0; margin-left:10px; overflow:hidden;">
        <span class="jiathis_txt">分享到：</span>
        <a class="jiathis_button_icons_1"></a>
        <a class="jiathis_button_icons_2"></a>
        <a class="jiathis_button_icons_3"></a>
        <a class="jiathis_button_icons_4"></a>
        <a href="http://www.jiathis.com/share" class="jiathis jiathis_txt jtico jtico_jiathis" target="_blank"></a>
        <a class="jiathis_counter_style"></a>
    </div>
    <script type="text/javascript" src="http://v3.jiathis.com/code/jia.js" charset="utf-8"></script>
    <!-- JiaThis Button END -->
</div>
<img src="./upload/service/small/<{$service.qr_code}>" width="135" height="151" style="display:block; float:right;" />

</div>
<div class="clear" style="height:30px;"></div>

<div id="allmap"> </div>


<img src="images/gg1.jpg" width="1097" height="101" style="display:block; margin:30px auto 0;" />

<span class="span_dlzc" id="F1"><a href="#">登录</a>|<a href="#">注册</a></span>
<span class="span_shuru">还可以输入140字</span>
<div class="liuyan_1">
<img src="images/tx_img.jpg" width="75" height="80" style="display:block; float:left;" />
<div class="liuyan_r_1">
<textarea name="comment" cols="" rows="" class="text_ly_1" id="saytext" maxlength="140"></textarea>

<!--新增-->
<span  id="huifuren"></span>
<input type='hidden' name='reply_id' class="reply_id" value="0" />
<!--新增-->

<ul class="ul_biaoqing">
<li style="margin-right:38px;"><a href="javascript:;" class="a_biaoqing emotion">表情</a></li>

<!-- <div id="show"></div> --> 

<li><input name="" type="checkbox" value="" />&nbsp;同步到微薄</li>
</ul>
<a href="javascript:;" class="a_pinglun">评论</a>
</div>
</div>
<span class="span_plsl"><{$commentNum}>条评论</span>

<{if $commentNum==0}>
<span class="span_qsf">还没有人评论过，赶紧抢沙发吧！</span>
<{else}>
  <{foreach item=loop from=$comment}>
    <div class="pinglun"> <img src="upload/user/small/<{$loop.avatar}>" width="45" height="45" style="display:block; float:left;" />
        <div class="pinglun_r1">
          <div class="pinglun_r_left"> <span><b> <a href="user_main.php?type=user&id=<{$loop.user_id}>"><{$loop.account}></a>：<{if $loop.reply_id>0}>回复&nbsp;@<a href="user_main.php?type=user&id=<{$loop.reply_id}>"><{$loop.account1}></a>：<{/if}></b><span class="neirong"><{$loop.comment}></span></span>
            <p><{$loop.create_time}></p>
          </div>
          <ul class="ul_pinglun_r">
            <li><a href="#F1" class="a_huifu1" user_id="<{$loop.user_id}>" name="<{$loop.account}>">回复</a></li>
            <!-- <li>|</li>
            <li><a href="#" class="a_huifu">21</a></li> -->
          </ul>
        </div>
    </div>
  <{/foreach}>
<{/if}>



</div>
<script type="text/javascript"> 
// 百度地图API功能
  var map = new BMap.Map("allmap");   //实例化地图
  
  var myCity = new BMap.LocalCity();    //获得当前城市
  myCity.get(myFun);  
        
  map.centerAndZoom(new BMap.Point(), 11);    //设置地图中心坐标
  map.enableScrollWheelZoom(true);    //鼠标滚轮放大
  //自定义函数（设置地图中心）
  function myFun(result){
    var cityName = result.name;
    map.setCenter(cityName);
  }
  //自定义函数点击标注位置
  function addMarker(point){
    var allover = map.getOverlays();
    for (var i = 0; i < allover.length; i++){
      map.removeOverlay(allover[i]);
    }
      var marker = new BMap.Marker(point);
      map.addOverlay(marker);
  }
  var local = new BMap.LocalSearch(map, {
    renderOptions:{map: map}
  });
  //默认标注
  if('<{$service.map_x}>'!=''){
    var x='<{$service.map_x}>';
    var y='<{$service.map_y}>';
    var points = new BMap.Point(x,y);
    addMarker(points);
  }
  //鼠标点击事件
  // map.addEventListener("click",function(e){
  //   var point = new BMap.Point(e.point.lng ,e.point.lat);
  //   addMarker(point);
  //   $("[name=map_x]").val(e.point.lng);
  //   $("[name=map_y]").val(e.point.lat);
  // })
  
  local.search("");
</script> 

<{include file="footer.html"}>
<SCRIPT language=javascript type=text/javascript> 
    var scrollPic_sevice = new ScrollPic();
    scrollPic_sevice.scrollContId   = "ISL_Cont_service"; //内容容器ID
    scrollPic_sevice.arrLeftId      = "LeftArr_service";//左箭头ID
    scrollPic_sevice.arrRightId     = "RightArr_service"; //右箭头I
    scrollPic_sevice.frameWidth     = 557;//显示框宽度
    scrollPic_sevice.pageWidth      = 557; //翻页宽
    scrollPic_sevice.speed          = 10; //移动速度(单位毫秒，越小越快)
    scrollPic_sevice.space          = 10; //每次移动像素(单位px，越大越快)
  
    if('<{$albums}>'!=''){
    scrollPic_sevice.autoPlay       = true; //自动播放
    }else{
    scrollPic_sevice.autoPlay       = false; //自动播放 
    }
    
    scrollPic_sevice.autoPlayTime   = 5; //自动播放间隔时间(秒
    scrollPic_sevice.initialize(); //初始化
</SCRIPT>